package com.zg.common.auth;

import lombok.Data;
import org.aspectj.lang.annotation.Aspect;
import org.aspectj.lang.annotation.Before;
import org.aspectj.lang.annotation.Pointcut;
import org.springframework.stereotype.Component;

/**
 * 对三方调用的请求进行验证
 * @author Zxb
 */
@Aspect
@Component
@Data
public class ThirdCallAspect {

	private AuthValidator authValidator;

	public ThirdCallAspect(AuthValidator authValidator) {
		this.authValidator = authValidator;
	}

    @Pointcut("@annotation(com.zg.common.auth.ThirdCall)")
    public void pointCut(){}

    @Before("pointCut()")
    public void beforeThirdCall(){
    	authValidator.validateThirdCall();
    }
}
